/**
 * setter
 * @author Brant Liu
 * @email lbf1988@qq.com
 * @date 2019/9/26
 * @version 1.0.0
 */
layui.define(['jquery'], function(exports){
    "use strict";
    var $ = layui.jquery;

    exports('setter', {
        appMenuId: "#sidebar-menu",
        validate: {
            errorClass: "error help-block",
            errorElement: "span",
            errorPlacement : function(error, element) {
                element.next('.error.help-block, .form-control-feedback').remove();
                element.after('<span class="icon-close form-control-feedback" aria-hidden="true"></span>');
                element.closest('.form-group').append(error);
            },
            success: function(element){
                var input = element.closest('.form-group').find("input");
                input.next('.error.help-block, .form-control-feedback').remove();
                input.after('<span class="icon-check form-control-feedback" aria-hidden="true"></span>');
                element.closest('.form-group').removeClass('has-error').addClass("has-success has-feedback");
                element.remove();
            },
            highlight: function(element){
                $(element).closest('.form-group').addClass('has-error has-feedback');
            }
        }
    });
});